// 一级Layout
import Main from '../layout/Main';
import Page from '../layout/Page';

// 二级页面
import Home from '../pages/Home';
import List from '../pages/List';
import Detail from '../pages/Detail';
import Cart from '../pages/Cart';
import My from '../pages/My';
import Login from '../pages/Login'

// 三级页面
import ListA from '../pages/ListA';
import ListB from '../pages/ListB';

const routes = [{
    from: "/",
    to: "/main"
  },
  {
    path: "/main",
    component: Main,
    children: [{
        from: '/main',
        to: '/main/home'
      },
      {
        path: '/main/home',
        component: Home
      },
      {
        path: '/main/list',
        component: List,
        children: [{
            from: '/main/list',
            to: '/main/list/lista'
          },
          {
            path: '/main/list/lista',
            component: ListA
          },
          {
            path: '/main/list/listb',
            component: ListB
          }
        ]
      },
      {
        path: '/main/my',
        component: My,
        auth: true
      }
    ]
  },
  {
    path: "/page",
    component: Page,
    children: [{
        from: '/page',
        to: '/page/login'
      },
      {
        path: '/page/detail/:id',
        component: Detail
      },
      {
        path: '/page/cart',
        component: Cart,
        auth: true
      },
      {
        path: '/page/login',
        component: Login
      }
    ]
  }

];

export default routes;